<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/12/10
 * Time: 11:28
 */

header("Content-Type:application/json;charset=utf-8");

if(isset($_REQUEST["g_id"])){
	$str= file_get_contents("../data/goods.json");
    $listArr=json_decode($str); 
    foreach($listArr as $item){  
        if($item->g_id==$_REQUEST["g_id"]){
	 		print_r(json_encode(array("status" => 1, "msg" => "获取成功", "data" => $item))); 
            return;
        } 
    } 
} else{
	 print_r(json_encode(array("status" => -1, "msg" => "参数错误")));
}